<template>
	<view class="content">
		<view class="addrBox bgIsWhite" @tap="showAddr = true">
			<image class="addrIcon" src="/pages_mine/pages/static/order/icon_addr.png" mode=""></image>
			<view class="rights" v-if="defaultAddr.show">
				<view class="namesBox">
					<view class="name overflow_one">{{defaultAddr.name}}</view>
					<view class="tel">{{defaultAddr.tel}}</view>
					<view class="clearBoth"></view>
				</view>
				<view class="addr overflow_two">{{defaultAddr.addrDetails}}</view>
			</view>
			<view class="rights" v-if="defaultAddr.show==false">
				<view class="none">暂无默认收货地址</view>
			</view>
			<uni-icons class="icons" type="arrowright" color="#262626" size="16"/>
			<view class="clearBoth"></view>
			<image class="BgBottom" src="/pages_mine/pages/static/order/icon_bg_sureOrder.png" mode=""></image>
		</view>
		
		<view class="dataBox bgIsWhite">
			<view v-for="(item,index) in datas" :key="index">
				<view class="topBox">
					<image class="logo" :src="item.storeLogo" mode=""></image>
					<view class="names overflow_one">{{item.storeName}}</view>
					<uni-icons class="icons" type="arrowright" color="rgb(153,153,153)" size="14"/>
				</view>
				<view class="clearBoth"></view>
				<view v-for="(items,indexs) in item.goodres" :key="indexs" style="margin-bottom: 40upx;">
					<image class="goodsImage" :src="items.thumb_url" mode=""></image>
					<view class="goodsRight">
						<view class="goodsName overflow_one fontSize15">{{items.goods_name}}</view>
						<view class="ruleBox fontSize12">{{items.goods_attr_str}}</view>
						<view class="clearBoth"></view>
						<view class="priceBox">
							<view class="price fontSemiBold">¥{{items.shop_price}}</view>
							<view class="buyNumber">x{{items.goods_num}}</view>
							<view class="clearBoth"></view>
						</view>
						<view class="clearBoth"></view>
					</view>
					<view class="clearBoth"></view>
				</view>
				
				<view class="dataRows isMargin" @tap=" btnTicket(item.coupon,index) "><!-- @tap="item.showTicket = true" -->
					<view class="left isBold">优惠券</view>
					<view class="rights">
						<view class="names fontSize12" v-if="item.UseTicket">优惠券抵扣{{item.UseTicket}}元</view>
						<uni-icons class="icons" type="arrowright" color="#262626" size="14"/>
					</view>
					<view class="clearBoth"></view>
				</view>
				<view class="dataRows">
					<view class="left isBold">商品总额</view>
					<view class="rights">
						<view class="priceNames fontSize15 fontSemiRegular">¥{{item.goodsAll}}</view>
					</view>
					<view class="clearBoth"></view>
				</view>
				<view class="dataRows">
					<view class="left fontSize13">运费</view>
					<view class="rights">
						<view class="priceNames color_orange fontSize15 fontSemiRegular">{{ item.freight ? '+¥item.freight':'¥0' }}</view>
					</view>
					<view class="clearBoth"></view>
				</view>
				<view class="dataRows" v-if="item.UseTicket">
					<view class="left fontSize13">优惠券</view>
					<view class="rights">
						<view class="priceNames color_orange fontSize15 fontSemiRegular">-¥{{item.UseTicket}}</view>
					</view>
					<view class="clearBoth"></view>
				</view>
				<view class="dataRows">
					<view class="left isBold thirdLeft">订单备注</view>
					<view class="rights seventhRight">
						<input class="thisInput" type="text" placeholder="选填，给卖家留言" v-model="item.getReamke">
					</view>
					<view class="clearBoth"></view>
				</view>
				<view style="width: 100%;height:80upx;"></view>
			</view>
			
			<view class="numberAndMoney">
				<view class="rightA color_orange">¥{{data.allMoney}}</view>
				<view class="center fontSize13">小计</view>
				<view class="left">共{{data.allNumber}}件</view>
				<view class="clearBoth"></view>
			</view>
		</view>


		<view class="integralBox bgIsWhite">
			<view class="leftBox">
				<view class="iconBox">
					<image class="icon" src="/pages_mine/pages/static/order/icon_integral.png" mode=""></image>
					<view class="iconName">积分</view>
					<view class="clearBoth"></view>
				</view>
				<view class="tip fontSize12">使用{{integralList.useIntergral}}个分抵扣</view>
				<view class="tips fontSize12 color_orange">{{integralList.useMoney}}元</view>
				<view class="clearBoth"></view>
				<view class="allIntegral fontSize12">共{{integralList.allIntergral}}积分，本次使用{{integralList.useIntergrals}}积分</view>
				<view class="clearBoth"></view>
			</view>
			<switch class="right" color="rgb(220,88,42)" @change="switchChange"/><!-- checked -->
			<view class="clearBoth"></view>
		</view>

		<view class="footer">
			<view class="footerName">应付总额</view>
			<view class="footerPrice fontSemiBold color_orange">¥{{data.allMoney}}</view>
			<view class="btnPay" @tap="showPay=true">支付订单</view>
		</view>

		<view class="payBox" v-if="showPay">
			<view class="bg_grey"></view>
			<view class="bg_white">
				<view class="title fontSize15">选择支付方式</view>
				<image class="icon" src="/static/index/details/icon_close2.png" mode="" @tap="showPay=false"></image>
				<view class="rows" @tap="choosePayWay(1)">
				<!-- <view class="rows" @tap="toOpen('two','one','two')"> -->
					<image class="useIcon" src="/pages_mine/pages/static/order/icon_money.png" mode=""></image>
					<view class="name fontSize15">钱包支付</view>
					<view class="names fontSize12">(余额￥{{data.wallet_price}})</view>
					<view  class="noneIcon" v-if="payWay == 0 || payWay == 2 "></view>
					<image class="thisOne" src="/pages_mine/pages/static/order/icon_bingo.png" mode="" v-if="payWay == 1"></image>
					<view class="clearBoth"></view>
				</view>
				<view class="clearBoth"></view>
				<view class="rows" @tap="choosePayWay(2)">
					<image class="useIcon" src="/pages_mine/pages/static/order/icon_wx.png" mode=""></image>
					<view class="name fontSize15">微信支付</view>
					<view  class="noneIcon" v-if="payWay == 0 || payWay == 1 "></view>
					<image class="thisOne" src="/pages_mine/pages/static/order/icon_bingo.png" mode="" v-if="payWay == 2"></image>
					<view class="clearBoth"></view>
				</view>
				<view class="btnSure" @tap="btnSure">确认</view>
			</view>
		</view>

		<view class="choosePlaceBox" v-if="showAddr">
			<view class="bg_grey"></view>
			<view class="bg_white">
				<view class="title fontSize15">选择配送地址</view>
				<image class="icon" src="/static/index/details/icon_close2.png" mode="" @tap="showAddr=false"></image>
				<view class="addrScroll">
					<view class="addrList" v-for="(item,index) in addrList" :key="index">
						<image class="thisOne" src="/pages_mine/pages/static/order/icon_bingo.png" mode="" v-if="item.beThis==true"  @tap="choosePlace(item.id,index)"></image>
						<view class="noneIcon" v-if="item.beThis==false"  @tap="choosePlace(item.id,index)"></view>
						<view class="rights">
							<view class="beThis fontSize12" v-if="item.isThis==true">默认</view>
							<view class="addrDetails overflow_one"  @tap="choosePlace(item.id,index)">{{item.addrDetails}}</view>
							<view class="clearBoth"></view>
							<view class="name fontSize13"  @tap="choosePlace(item.id,index)">{{item.name}}</view>
							<view class="tel fontSize13"  @tap="choosePlace(item.id,index)">{{item.tel}}</view>
							<image class="iconEdit" src="/pages_mine/pages/static/icon_edit.png" mode="" @tap="btnAddrEdit(item.id)"></image>
						</view>
						<view class="clearBoth"></view>
					</view>
				</view>
				<view class="btnSure" @tap="btnAddAddr">新增收货地址</view>
			</view>
		</view>
		
		<view class="chooseTicketBox" v-if="showTicket">
			<view class="bg_grey"></view>
			<view class="bg_white">
				<view class="title">当前优惠</view>
				<view class="ticketScrollBox">
					<view class="ticketList" v-for="(item,index) in ticketList" :key="index">
						<view class="priceBoxs">
							<view class="ticketPrice fontSemiBold">{{item.price_desc}}</view>
							<view class="priceName">优惠券(元)</view>
						</view>
						<view class="ticketNameBox">
							<!-- <view class="ticketTitle">{{item.type}}优惠券</view> -->
							<view class="ticketTitle">{{item.tips}}</view>
							<view class="ticketUseTime">有效期:{{item.invalid_time}}</view>
							<view class="useWay">{{item.use_desc}}</view>
						</view>
						<view class="ticketLineCenter">
							<!-- <view class="getTicketBtn" @tap="getTicketNow(item.id,index,item.price)">去使用</view> -->
							<view class="getTicketBtn" @tap="getTicketNow(item.id,index,item.price_desc)">去使用</view>
						</view>
						<view class="clearBoth"></view>
					</view>
				</view>
				<view class="btnSure" @tap="showTicket = false">关闭</view>
			</view>
		</view>
		
		<jp-pwd ref="jpPwds"
			@completed="completed" 
			@inputPwd="inputPwd" 
			@forget="forget" 
			:money="pwd.money" 
			:payType="pwd.payType"
			:keyType="pwd.keyType" 
			:pawType="pwd.pawType" 
			:tite="pwd.tite" 
			:contents="pwd.contents" 
			:cancelType="pwd.cancelType"
			:keep="pwd.keep" 
			:msg="pwd.msg" 
			:places="pwd.places" 
			contentsColor="#555" 
			:isPwy="pwd.isPwy"
			titeColor="#333">
		</jp-pwd>

	</view>
</template>
<style>
	.content{width:100%;min-height: 100vh;background: rgb(245,245,249);padding:20upx 2.5% 150upx 2.5%;}
	.content .bgIsWhite{background: white;border-radius: 10upx;padding:5%;}
	.content .color_orange{color:#DC582A !important}
	.content .addrBox{width: 100%;padding-bottom: 0;}
	.content .addrBox .addrIcon{width:52upx;height: 52upx;margin-top:34upx;float: left;margin-right: 5%;}
	.content .addrBox .icons{float: right;margin-top:36upx;}
	.content .addrBox .rights{width:80%;height: 110upx;float: left;}
	.content .addrBox .rights .namesBox{width: 100%;}
	.content .addrBox .rights .namesBox .name{max-width: 50%;float: left;font-weight: bold;font-size: 32upx;color:#000000;}
	.content .addrBox .rights .namesBox .tel{float: left;margin-left: 10upx;color:#010101;font-size: 32upx;}
	.content .addrBox .rights .addr{color:#444444;font-size: 26upx;margin-top:10upx;}
	.content .addrBox .rights .none{width:100%;height: 110upx;line-height: 110upx;}
	.content .addrBox .BgBottom{width: 110%;height:10upx;margin-top: 5%;margin-left: -5%;}
	.content .dataBox{width: 100%;margin-top: 40upx;}
	.content .dataBox .topBox{width: 100%;display: flex;justify-content: left;}
	.content .dataBox .topBox .logo{width: 44upx;height: 44upx;border-radius: 44upx;}
	.content .dataBox .topBox .names{max-width:60%;height: 44upx;line-height: 44upx;margin:0 10upx 0 20upx;font-size: 30upx;font-weight: bold;color:#010101;}
	.content .dataBox .topBox .icons{margin-top:8upx;}
	.content .dataBox .goodsImage{width:180upx;height: 180upx;border-radius: 10upx;float: left;margin-right: 5%;margin-top: 20upx;}
	.content .dataBox .goodsRight{width: 65%;height:180upx;float: left;margin-top: 20upx;}
	.content .dataBox .goodsRight .goodsName{}
	.content .dataBox .goodsRight .ruleBox{height:32upx;color:#999999;float: left;margin:20upx 0 40upx 0}
	.content .dataBox .goodsRight .priceBox{width: 100%;height:70upx;line-height: 70upx;}
	.content .dataBox .goodsRight .priceBox .price{color:#262626;font-size: 40upx;float: left;}
	.content .dataBox .goodsRight .priceBox .buyNumber{color:#000000;font-weight: bold;float: right;}
	.content .dataBox .dataRows{width: 100%;}
	.content .dataBox .isMargin{margin:20upx 0 0upx 0;}
	.content .dataBox .isBold{font-weight: bold;}
	.content .dataBox .dataRows .left{width: 50%;float: left;font-weight: bold;}
	.content .dataBox .dataRows .rights{width: 50%;float: right;}
	.content .dataBox .dataRows .rights .names{width: 80%;color:#BBBBBB;float: left;text-align: right;}
	.content .dataBox .dataRows .rights .priceNames{width:100%;color:#262626;float: left;text-align: right;}
	.content .dataBox .dataRows .rights .icons{color:#BBBBBB;float: right;}
	.content .dataBox .dataRows .thirdLeft{width: 30%;float: left;margin-top: 20upx;}
	.content .dataBox .dataRows .seventhRight{width: 70%;float: left;margin-top: 20upx;}
	.content .dataBox .dataRows .rights .thisInput{width:100%;text-align: left;}
	.content .dataBox .numberAndMoney{width: 100%;text-align: right;margin-top:0upx;}
	.content .dataBox .numberAndMoney .left{height:64upx;line-height:64upx;float:right;font-size: 26upx;color:#999999;}
	.content .dataBox .numberAndMoney .center{height:64upx;line-height:64upx;float:right;font-size: 26upx;margin:0 20upx}
	.content .dataBox .numberAndMoney .rightA{height:64upx;line-height:64upx;float:right;font-size:36upx;font-family:'Bahnschrift-SemiBold'}
	.content .integralBox{width: 100%;margin-top: 40upx;}
	.content .integralBox .leftBox{width:75%;float: left;}
	.content .integralBox .leftBox .iconBox{padding:4upx 10upx;border-radius: 100upx;background: rgb(220,88,42);float: left;}
	.content .integralBox .leftBox .icon{width: 22upx;height: 22upx;float: left;margin-top:6upx;}
	.content .integralBox .leftBox .iconName{font-size:22upx;float: left;color:white;margin-left:10upx;}
	.content .integralBox .leftBox .tip{color:#262626;float: left;margin:4upx 20upx 0 20upx}
	.content .integralBox .leftBox .tips{float: left;margin-top:4upx;}
	.content .integralBox .leftBox .allIntegral{color:#999999;margin-top: 10upx;}
	.content .integralBox .right{float: right;}
	.content .footer{width: 100%;height: 100upx;line-height: 100upx;position: fixed;left:0;bottom: 0;z-index: 2;background: white;}
	.content .footer .footerName{color:#B3B3B3;float: left;margin:0 20upx 0 5%}
	.content .footer .footerPrice{font-size:48upx;float: left;}
	.content .footer .btnPay{padding:0 30upx;font-size: 32upx;margin-right: 5%;height:60upx;line-height: 60upx;margin-top: 20upx;float: right;background: #DC582A;color:white;border-radius: 100upx;}
	.content .payBox{width: 100%;height: 100vh;position: fixed;top:0;left:0;z-index: 2;}
	.content .payBox .bg_grey{width: 100%;height: 30vh;position: fixed;top:0;left:0;z-index: 2;background: rgba(0,0,0,0.4);}
	.content .payBox .bg_white{width: 100%;height: 70vh;position: fixed;bottom:0;left:0;z-index: 2;background: white;}
	.content .payBox .bg_white .title{width: 100%;text-align: center;color:#262626;font-weight: bold;padding:30upx 0;border-bottom: 2upx solid #DDDDDD;}
	.content .payBox .bg_white .icon{width: 28upx;height: 28upx;position: absolute;top:2%;right:2%;z-index: 2;}
	.content .payBox .bg_white .rows{width: 100%;margin:40upx 0;}
	.content .payBox .bg_white .rows .useIcon{width: 54upx;height: 54upx;float: left;margin-left: 5%;}
	.content .payBox .bg_white .rows .name{float: left;height: 54upx;line-height:54upx;margin:0 20upx;font-weight: bold;}
	.content .payBox .bg_white .rows .names{float: left;height: 54upx;line-height:54upx;margin:0;color:#BBBBBB}
	.content .payBox .bg_white .rows .noneIcon{width: 32upx;height: 32upx;border:2upx solid grey;border-radius: 100upx;float: right;margin:20upx 5% 0 0}
	.content .payBox .bg_white .rows .thisOne{ width: 32upx;height: 32upx;float: right;margin:20upx 5% 0 0}/* border:2upx solid rgb(220,88,42); */
	.content .payBox .bg_white .btnSure{width: 90%;padding: 15upx 0;margin-left: 5%;color:white;background: rgb(220,88,42);border-radius: 200upx;text-align: center;font-size: 36upx;position: absolute;left:0;bottom: 5%;z-index: 2;}
	.content .choosePlaceBox{width: 100%;height: 100vh;position: fixed;top:0;left:0;z-index: 2;}
	.content .choosePlaceBox .bg_grey{width: 100%;height: 30vh;position: fixed;top:0;left:0;z-index: 2;background: rgba(0,0,0,0.4);}
	.content .choosePlaceBox .bg_white{width: 100%;height: 70vh;position: fixed;bottom:0;left:0;z-index: 2;background: white;}
	.content .choosePlaceBox .bg_white .title{width: 100%;text-align: center;color:#262626;font-weight: bold;padding:30upx 0;border-bottom: 2upx solid #DDDDDD;}
	.content .choosePlaceBox .bg_white .icon{width: 28upx;height: 28upx;position: absolute;top:2%;right:2%;z-index: 2;}
	.content .choosePlaceBox .bg_white .btnSure{width: 90%;padding: 15upx 0;margin-left: 5%;color:white;background: rgb(220,88,42);border-radius: 200upx;text-align: center;font-size: 36upx;position: absolute;left:0;bottom: 5%;z-index: 2;}
	.content .choosePlaceBox .bg_white .addrScroll{width: 100%;height: 70%;margin-top: 20upx;overflow-y: scroll;}
	.content .choosePlaceBox .bg_white .addrScroll .addrList{width: 95%;margin-left:2.5%;margin-top: 40upx;}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .noneIcon{width: 32upx;height: 32upx;border:2upx solid grey;border-radius: 100upx;float: left;margin:40upx 5% 0 0}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .thisOne{ width: 32upx;height: 32upx;float: left;margin:40upx 5% 0 0}/* border:2upx solid rgb(220,88,42); */
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights{width:90%;padding-bottom: 20upx;float:left;border-bottom: 2upx solid #DDDDDD;}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights .beThis{font-weight: bold;margin-right: 5%;color:rgb(220,88,42);background: rgb(251,238,233);float: left;padding:10upx;border-radius: 4upx;}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights .addrDetails{width:72%;float: left;font-weight: bold;font-size:30upx;}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights .name{float: left;margin-top:20upx;color:#262626}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights .tel{float: left;margin-top:20upx;margin-left: 5%;color:#262626}
	.content .choosePlaceBox .bg_white .addrScroll .addrList .rights .iconEdit{width: 28upx;height: 30upx;float: right;}
	.content .chooseTicketBox{}
	.content .chooseTicketBox{width: 100%;height: 100vh;position: fixed;top:0;left:0;z-index: 2;}
	.content .chooseTicketBox .bg_grey{width: 100%;height: 30vh;position: fixed;top:0;left:0;z-index: 2;background: rgba(0,0,0,0.4);}
	.content .chooseTicketBox .bg_white{width: 100%;height: 70vh;position: fixed;bottom:0;left:0;z-index: 2;background: rgb(245,245,249);}
	.content .chooseTicketBox .bg_white .title{font-size: 40upx;width: 100%;text-align: center;color:#262626;font-weight: bold;padding:30upx 0;}
	.content .chooseTicketBox .bg_white .btnSure{width: 90%;padding: 15upx 0;margin-left: 5%;color:white;background: rgb(220,88,42);border-radius: 200upx;text-align: center;font-size: 36upx;position: absolute;left:0;bottom: 5%;z-index: 2;}
	.content .chooseTicketBox .bg_white .ticketScrollBox{width: 100%;height:75%;overflow-y: scroll;}
	.content .chooseTicketBox .bg_white .ticketList{width:95%;margin-left: 2.5%;margin-bottom: 40upx;border-radius: 10upx;background: white;padding:2.5%;}
	.content .chooseTicketBox .bg_white .ticketList .priceBoxs{width: 30%;float: left;text-align: center;}
	.content .chooseTicketBox .bg_white .ticketList .priceBoxs .ticketPrice{font-size: 100upx;height:130upx;line-height: 130upx;color:#DC582A;}
	.content .chooseTicketBox .bg_white .ticketList .priceBoxs .priceName{font-size: 24upx;color:#DC582A;}
	.content .chooseTicketBox .bg_white .ticketNameBox{width: 40%;float: left;text-align: left;margin-left: 5%;}
	.content .chooseTicketBox .bg_white .ticketNameBox .ticketTitle{font-size:36upx;font-weight: bold;color:#262626;margin-top: 20upx;}
	.content .chooseTicketBox .bg_white .ticketNameBox .ticketUseTime{font-size: 26upx;color:#999999;font-weight: bold;margin:10upx 0 20upx 0}
	.content .chooseTicketBox .bg_white .ticketNameBox .useWay{font-size: 26upx;color:#BBBBBB;}
	.content .chooseTicketBox .bg_white .ticketLineCenter{width: 25%;height:164upx;display: flex;align-items: center;}
	.content .chooseTicketBox .bg_white .getTicketBtn{width: 100%;padding:10upx 0;color:white;border-radius: 200upx;text-align: center;background: rgb(220,88,42);float: right;font-size: 26upx;}
</style>
<script>
	import Share from '@/common/wx_share.js'
	import jpPwd from '@/components/jp-pwd/jp-pwd.vue';
	export default {
		components: {
			jpPwd
		},
		data() {
			return {
				share:{
					title:"",
					path:'/pages/tabbar/index',
					imageUrl:'',
					desc:'',
					content:''
				},
				data:{
					allMoneyDontChange:"",
					allMoney:"",
					allNumber:"",
					wallet_price:"",
					radio:false,
					pwd:"",
				},
				datas:[],
				integralList:{
					useIntergral:"",
					useMoney:"",
					allIntergral:"",
					useIntergrals:0,
				},
				showPay:false,
				payWay:0,
				showAddr:false,
				addrList:[
					// {id:1,name:"王某人",tel:123123123213,isThis:true,beThis:true,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"},
					// {id:1,name:"王某人1",tel:123123123213,isThis:false,beThis:false,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"},
					// {id:1,name:"王某人2",tel:123123123213,isThis:false,beThis:false,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"},
					// {id:1,name:"王某人3",tel:123123123213,isThis:false,beThis:false,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"},
					// {id:1,name:"王某人4",tel:123123123213,isThis:false,beThis:false,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"},
					// {id:1,name:"王某人5",tel:123123123213,isThis:false,beThis:false,addrDetails:"漕溪三村小区 南区492号楼102漕溪三村小区 南区492号楼102"}
				],
				defaultAddr:{
					id:"",
					name:"",
					tel:"",
					isThis:"",
					beThis:"",
					addrDetails:"",
					show:false
				},
				showTicket:false,
				ticketList:[
					// {price:123,type:"商品",useTime:"2021.12.30"},
					// {price:12,type:"平台",useTime:"2021.12.30"},
					// {price:2,type:"商品",useTime:"2021.12.30"},
					// {price:123,type:"商品",useTime:"2021.12.30"},
					// {price:12,type:"平台",useTime:"2021.12.30"},
					// {price:2,type:"商品",useTime:"2021.12.30"},
				],
				UseTicket:"",
				pages:1,
				arrId:"",
				thisIndex:"",

				pwd: {
					money: 0,
					payType: 'one',
					keyType: 'one',
					pawType: 'one',
					tite: '请输入支付密码',
					cancelType: false,
					keep: false,
					msg: '',
					places: 6,
					isPwy: true
				},
				order_number:"",
				zf_type:"",
				
			}
		},
		onLoad(e){
			this.arrId = e.arrId
			this.AjaxLoad()
		},
		onShow(){
			this.defaultAddr.show = false
			this.addrList = []
			this.AjaxLoadAddrList()
		},
		onReachBottom(){
			if( this.showAddr == true ){
				this.pages++
				this.AjaxLoadAddrList()
			}
		},
		methods: {
			AjaxLoad(e){
				var datas = []
				let param={
					token:this._$userToken("userInfo").token,
					cart_idres:this.arrId 
				};
				this._$InitRequest.request("order/cartsure", param).then(res => {
					if( res.data.address !== "" ){
						this.defaultAddr.id = res.data.address.id
						this.defaultAddr.name = res.data.address.contacts
						this.defaultAddr.tel = res.data.address.phone
						this.defaultAddr.isThis = true
						this.defaultAddr.beThis = true
						this.defaultAddr.show = true
						this.defaultAddr.addrDetails = res.data.address.pro_name + res.data.address.city_name + res.data.address.area_name + res.data.address.address
					}
					//总价 数量 钱包yue
					this.data.wallet_price = res.data.wallet_price
					this.data.allNumber = res.data.zong_num
					this.data.allMoney = res.data.zsprice
					this.data.allMoneyDontChange = res.data.zsprice
					//积分
					this.integralList.allIntergral = res.data.integral.total
					this.integralList.useIntergral = res.data.integral.ky_integral
					this.integralList.useMoney = res.data.integral.price
					
					res.data.goodinfo.forEach( (item)=>{
						datas.push({
							shopId:item.goodres[0].shop_id,
							storeLogo:item.logo,
							storeName:item.shop_name,
							goodres:item.goodres,
							coupon:item.coupon,
							freight:item.freight,
							goodsAll:item.xiaoji_price,
							showTicket:false,
							UseTicket:"",
							getReamke:"",
							UseTicketId:""
						})
					})
					for (var i = 0; i < datas.length; i++){this.datas.push( datas[i] )}
				},error=>{})
			},
			AjaxLoadAddrList(){
				var addrList = []
				let param={
					token:this._$userToken("userInfo").token,
					page:this.pages
				};
				this._$InitRequest.request("Address/index", param).then(res => {
					res.data.forEach( (item) =>{
						addrList.push({
							id:item.id,
							addrDetails:item.pro_name + item.city_name + item.area_name + item.address,
							name:item.contacts,
							tel:item.phone,
							beThis:false,
							isThis:false,
							show:false
						})
					})
					for (var i = 0; i < addrList.length; i++){this.addrList.push( addrList[i] )}
				},error=>{})
			},
			AjaxAddorder(){
				// var coupon_idList = [],remark_list = []
				var that = this
				var coupon_idList = []
				var remark_list = []
				var integral = 0,dz_id = "",zf_type = ""
				if( this.data.radio == true )integral = 1
				if( this.payWay == 1 ){
					zf_type = 3
				}else if( this.payWay == 2 ){
					zf_type = 2
				}
				dz_id = this.defaultAddr.id
				this.datas.forEach( (item,index) =>{
					// if( item.UseTicket ){
					// 	coupon_idList.push({
					// 		item.shopId:item.UseTicket,
					// 	})
					// }
					// if( item.getReamke ){
					// 	remark_list.push({
					// 		item.shopId:item.getReamke,
					// 	})
					// }
					if( item.UseTicketId ){
						// let value = {[item.shopId]:item.UseTicketId}
						// coupon_idList.push(value)
						coupon_idList.push({
							shop_id:item.shopId,
							value:item.UseTicketId
						})
					}
					if( item.getReamke ){
						// let value = {[item.shopId]:item.getReamke}
						// remark_list.push(value)
						remark_list.push({
							shop_id:item.shopId,
							value:item.getReamke
						})
					}
				})
				coupon_idList = JSON.stringify(coupon_idList)
				remark_list   = JSON.stringify(remark_list)
				
				this.zf_type = zf_type
				if( this.order_number ){
					this.AjaxPay()
				}else{
					let param={
						"token":this._$userToken("userInfo").token,
						"cart_idres":this.arrId,
						"integral":integral,
						"zf_type":zf_type,
						"dz_id":dz_id,
						"remark":remark_list,
						"coupon_id":coupon_idList,
					};
					this._$InitRequest.request("order/addorder", param).then(res => {
						this.order_number = res.data.order_number
						uni.showToast({icon:"none",title:res.mess})
						if( res.status == 200 ){
							this.AjaxPay()
						}
					},error=>{})
				}
			},
			AjaxPay(){
				let params={
					token:this._$userToken("userInfo").token,
					order_number:this.order_number,
					zf_type:this.zf_type,
					pay_password:this.data.pwd,
				};
				this._$InitRequest.request("order/zhifu", params).then(resA => {
					if( resA.status !== 200 ){
						uni.showToast({icon:"none",title:resA.mess})
						that.$refs.jpPwds.toCancel()
						return;
					}else{
						uni.showToast({icon:"none",title:resA.mess})
						if( this.zf_type == 2 ){
							uni.requestPayment({
							   provider: 'wxpay',
							   appId: resA.data.wxpayinfos.appId,
							   timeStamp: String(resA.data.wxpayinfos.timestamp),
							   nonceStr: resA.data.wxpayinfos.nonceStr,
							   package:"prepay_id="+resA.data.wxpayinfos.package,
							   signType: 'MD5',
							   paySign: resA.data.wxpayinfos.sign,
							    success: function (resB) {
									setTimeout(function(){
										uni.navigateTo({
											url:"/pages_mine/pages/pay_finish/pay_finish?num=" + resA.data.order_num
										})
									},1500)
							    },
							    fail: function (err) {
							        console.log('fail:' + JSON.stringify(err));
							    }
							});
						}else if( this.zf_type == 3 ){
							setTimeout(function(){
								uni.navigateTo({
									url:"/pages_mine/pages/pay_finish/pay_finish?num=" + resA.data.order_num
								})
							},1500)
						}
					}
				},error=>{})
			},
			switchChange(e){
				this.data.allMoney = Number(this.data.allMoney)
				this.integralList.useMoney = Number(this.integralList.useMoney)
				if( e.detail.value == true ){
					this.data.radio = true
					this.integralList.useIntergrals = this.integralList.useIntergral
					this.data.allMoney -= this.integralList.useMoney
				}else{
					this.integralList.useIntergrals = 0
					this.data.allMoney += this.integralList.useMoney
					this.data.radio = false
				}
			},
			choosePayWay(e){this.payWay = e},
			choosePlace(id,index){
				for (var i = 0; i < this.addrList.length; i++) {
					this.addrList[i].beThis = false
				}
				this.addrList[index].beThis = true
				this.addrList[index].show = true
				this.defaultAddr = this.addrList[index]
			},
			getTicketNow(id,index,price){
				var allPrice = 0
				this.showTicket = false
				this.datas[this.thisIndex].UseTicket = price
				this.datas[this.thisIndex].UseTicketId = id
				for (var i = 0; i < this.datas.length; i++) {
					allPrice += Number(this.datas[i].UseTicket)
				}
				this.data.allMoney = this.data.allMoneyDontChange 
				this.data.allMoney -= allPrice
				
				console.log( id );
			},
			btnSure(){
				//余额1，微信支付2
				// uni.navigateTo({
				// 	url:"/pages/mine/pay_finish/pay_finish"
				// })
				if( this.payWay == 0 ){
					uni.showToast({title:"请选择支付方式",icon:"none"})
					return
				}else if( this.payWay == 1 ){
					this.pwd.money = this.data.allMoney
					this.toOpen('two','one','two')
				}else if( this.payWay == 2 ){
					this.AjaxAddorder()
				}
			},
			btnAddAddr(){
				uni.navigateTo({
					url:"/pages_mine/pages/addr_mine/addr_mine"
				})
			},
			btnAddrEdit(id){
				uni.navigateTo({
					url:"/pages_mine/pages/edit_add_addr/edit_add_addr?id=" + id
				})
			},
			btnTicket(item,index){
				this.ticketList = []
				this.showTicket = true
				this.ticketList = item
				this.thisIndex = index
			},
			toOpen(payType, keyType, pawType) {
				this.pwd.isPwy = true
				this.pwd.payType = payType
				this.pwd.keyType = keyType
				this.pwd.pawType = pawType
				this.pwd.places = 6
				this.$refs.jpPwds.toOpen()
			},
			inputPwd(e) {this.pwd.msg = ''},
			completed(e) {
				this.data.pwd = e
				this.AjaxAddorder()
				return;
				if (e == '123456') {
					this.$refs.jpPwds.toCancel()
				} else {
					this.pwd.msg = '密码错误'
					this.$refs.jpPwds.backs()
				}
			},
			
			
			
			
			
		}
	}
</script>
<style lang="scss" scoped>
/deep/ .uni-input-input {font-size:28upx}
/deep/ .uni-radio-input-checked{background-color:rgb(110,43,34) !important;border:2upx solid white !important}
.content .html{
  ::v-deep {
    img {
      width: 100%;
    }
  }
}
</style>